def dec_generator(max_count: int, start: str = "00", step: str = "01"):
    sn_length = len(start)
    tail_length = len(step)
    if sn_length < tail_length:
        raise ValueError(
            "SN start length must be greater than or equal to step length."
        )
    head_length = sn_length - tail_length
    sn_head = start[:head_length]
    sn_tail_start = int(start[head_length:])
    sn_tail_step = int(step)
    next_sn_tail = sn_tail_start
    for _ in range(max_count):
        next_sn = f"{sn_head}{next_sn_tail:0{tail_length}d}"
        yield next_sn
        next_sn_tail += sn_tail_step
        next_sn_tail %= 10**tail_length


def hex_generator(max_count: int, start: str = "00", step: str = "01"):
    sn_length = len(start)
    tail_length = len(step)
    if sn_length < tail_length:
        raise ValueError(
            "SN start length must be greater than or equal to step length."
        )
    head_length = sn_length - tail_length
    sn_head = start[:head_length]
    sn_tail_start = int(start[head_length:], 16)
    sn_tail_step = int(step, 16)
    next_sn_tail = sn_tail_start
    for _ in range(max_count):
        next_sn = f"{sn_head}{next_sn_tail:0{tail_length}X}"
        yield next_sn
        next_sn_tail += sn_tail_step
        next_sn_tail %= 16**tail_length


def generator(max_count: int, start: str = "00", step: str = "01", base: int = 10):
    if base == 10:
        return dec_generator(max_count, start, step)
    elif base == 16:
        return hex_generator(max_count, start, step)
    else:
        raise ValueError("Base must be 10 or 16.")
